package com.example.demo.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
public class ThreadInput2  {
	private Integer id;
	private String customerSex;//客户性别
	private String area;//区域

	private String phone;//客户联系电话
	private String weiXin;//客户微信号
	private String customerZhiwei;//客户职业
	private String jieQia;//接洽方式
	private String huoKeTuJing;//获客途径
	private List<NewCar1> cars=new ArrayList<>();//拟购车型
	private List<UsedCar1> oldcars1=new ArrayList<UsedCar1>();//拟购二手车
	private String idCard;//身份证号
	private List<NewCar1> cars2=new ArrayList<>();//试乘车型
	private List<UsedCar1> oldcars2=new ArrayList<UsedCar1>();//试乘二手车
	private String feel;//试乘试驾感受
	private String number;//试乘次数
	private String reachStore;//到店次数
	private String followNum;//跟进次数
	private String followRank;//跟进意向级别
	private String customerState;//客户状况
	private String payment;//付款方式
	private String zhiHuan;//置换意向
	private Date date;//录入日期
	private SysDept dept;//所属部门
	private Position zhiwei;//职位
	
	private Date beginDate;//开始修改日期
	private Date endDate;//结束修改日期
	private ThreadInput thread;//绑定的线索表
	
	
	
	
	
	@ManyToOne
	public ThreadInput getThread() {
		return thread;
	}
	public void setThread(ThreadInput thread) {
		this.thread = thread;
	}
	
	
	@Id
	@GeneratedValue
	@JsonIgnore
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getBeginDate() {
		return beginDate;
	}
	public void setBeginDate(Date beginDate) {
		this.beginDate = beginDate;
	}
	
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getEndDate() {
		return endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	
	


	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	
	
	
	public String getCustomerSex() {
		return customerSex;
	}
	public void setCustomerSex(String customerSex) {
		this.customerSex = customerSex;
	}
	public String getArea() {
		return area;
	}
	public void setArea(String area) {
		this.area = area;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getWeiXin() {
		return weiXin;
	}
	public void setWeiXin(String weiXin) {
		this.weiXin = weiXin;
	}
	public String getCustomerZhiwei() {
		return customerZhiwei;
	}
	public void setCustomerZhiwei(String customerZhiwei) {
		this.customerZhiwei = customerZhiwei;
	}
	public String getJieQia() {
		return jieQia;
	}
	public void setJieQia(String jieQia) {
		this.jieQia = jieQia;
	}
	public String getHuoKeTuJing() {
		return huoKeTuJing;
	}
	public void setHuoKeTuJing(String huoKeTuJing) {
		this.huoKeTuJing = huoKeTuJing;
	}

	@ManyToMany
	public List<NewCar1> getCars() {
		return cars;
	}
	public void setCars(List<NewCar1> cars) {
		this.cars = cars;
	}
	
	
	@ManyToMany
	public List<NewCar1> getCars2() {
		return cars2;
	}
	public void setCars2(List<NewCar1> cars2) {
		this.cars2 = cars2;
	}
	
	
	
	public String getIdCard() {
		return idCard;
	}
	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}

	public String getFeel() {
		return feel;
	}
	public void setFeel(String feel) {
		this.feel = feel;
	}

	public String getNumber() {
		return number;
	}
	public void setNumber(String number) {
		this.number = number;
	}
	public String getReachStore() {
		return reachStore;
	}
	public void setReachStore(String reachStore) {
		this.reachStore = reachStore;
	}
	public String getFollowNum() {
		return followNum;
	}
	public void setFollowNum(String followNum) {
		this.followNum = followNum;
	}
	public String getFollowRank() {
		return followRank;
	}
	public void setFollowRank(String followRank) {
		this.followRank = followRank;
	}
	public String getCustomerState() {
		return customerState;
	}
	public void setCustomerState(String customerState) {
		this.customerState = customerState;
	}
	public String getPayment() {
		return payment;
	}
	public void setPayment(String payment) {
		this.payment = payment;
	}
	public String getZhiHuan() {
		return zhiHuan;
	}
	public void setZhiHuan(String zhiHuan) {
		this.zhiHuan = zhiHuan;
	}
	
	
	
	
	
	
	
	
	
	@ManyToOne
	public SysDept getDept() {
		return dept;
	}
	public void setDept(SysDept dept) {
		this.dept = dept;
	}
	
	@ManyToOne
	public Position getZhiwei() {
		return zhiwei;
	}
	public void setZhiwei(Position zhiwei) {
		this.zhiwei = zhiwei;
	}
	
	
	
	
	
	
	@ManyToMany
	public List<UsedCar1> getOldcars1() {
		return oldcars1;
	}
	public void setOldcars1(List<UsedCar1> oldcars1) {
		this.oldcars1 = oldcars1;
	}
	
	@ManyToMany
	public List<UsedCar1> getOldcars2() {
		return oldcars2;
	}
	public void setOldcars2(List<UsedCar1> oldcars2) {
		this.oldcars2 = oldcars2;
	}
	
	
	@Transient
	public String getCarsId() {
		String str="";
		for (NewCar1 car : getCars()) {
			str+=car.getId()+",";
		}
		if(str.indexOf(",")>0) {
			str=str.substring(0,str.length()-1);
		}
		return str;
	}
	@Transient
	public String getOldCars1Id() {
		String str="";
		for (UsedCar1 car :getOldcars1()) {
			str+=car.getId()+",";
		}
		if(str.indexOf(",")>0) {
			str=str.substring(0,str.length()-1);
		}
		return str;
	}	
	
	@Transient
	public String getOldCars2Id() {
		String str="";
		for (UsedCar1 car :getOldcars2()) {
			str+=car.getId()+",";
		}
		if(str.indexOf(",")>0) {
			str=str.substring(0,str.length()-1);
		}
		return str;
	}
	
	@Transient
	public String getCars2Id() {
		String str="";
		for (NewCar1 car : getCars2()) {
			str+=car.getId()+",";
		}
		if(str.indexOf(",")>0) {
			str=str.substring(0,str.length()-1);
		}
		return str;
	}
	
	
	
}
